﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sharp.Portal.AdminLTE.Provider;
using Sharp.Portal.Mvc.List;

namespace Sharp.Portal.AdminLTE
{
    /// <summary>
    /// 树形列表
    /// </summary>
    public class BSSharpTreeList : SharpTreeList
    {
        /// <summary>
        /// 树形列表
        /// </summary>
        public BSSharpTreeList() : base()
        {
            ListControlId = "dataList";
        }
        /// <summary>
        /// 处理移动设备
        /// </summary>
        public override void HandleMobileDevice()
        {
        }
        /// <summary>
        /// 主数据转换文本项
        /// </summary>
        /// <param name="category"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public string GetMasterDataText(string category, string code)
        {
            var data = Platform.GetMasterData(category);

            return data.FirstOrDefault(x => x.Code == code)?.Name;
        }
        /// <summary>
        /// 初始化适配器
        /// </summary>
        public override void InitProvider()
        {
            this.Provider = new ListTreePage();
        }
    }
}